package com.apetrenko.avaya.callstore.client;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Hyperlink;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;

public class StartPane extends Composite {

	private class StartTopPanel extends Composite {

		private VerticalPanel iPanel = new VerticalPanel();
		private HorizontalPanel iUpperPanel = new HorizontalPanel();
		private HorizontalPanel iLowerPanel = new HorizontalPanel();

		public StartTopPanel() {
			iUpperPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_RIGHT);

			iUpperPanel.setStyleName("yapm-top-upper");

			iLowerPanel.setHorizontalAlignment(HorizontalPanel.ALIGN_LEFT);
			iLowerPanel.setVerticalAlignment(HorizontalPanel.ALIGN_MIDDLE);

			HTML vCaption = new HTML("<b>CallStore Web Console</b>");
			vCaption.setStyleName("yapm-top-lower-caption");

			iLowerPanel.add(vCaption);
			iLowerPanel.setStyleName("yapm-top-lower");

			iUpperPanel.add(new Hyperlink("Help", "help"));

			iPanel.add(iUpperPanel);
			iPanel.add(iLowerPanel);
			iPanel.setWidth("100%");

			initWidget(iPanel);

			this.setWidth("100%");
			this.setHeight("25px");
		}

	}

	private DockPanel iOuter = new DockPanel();
	private SimplePanel iCenterPanel = new SimplePanel();
	private LoginPanel iLoginPanel = new LoginPanel();

	public StartPane() {

		iCenterPanel.setWidth("100%");

		iOuter.add(new StartTopPanel(), DockPanel.NORTH);
		iOuter.add(iLoginPanel, DockPanel.EAST);
		iOuter.setCellVerticalAlignment(iLoginPanel, DockPanel.ALIGN_TOP);
		iOuter.add(iCenterPanel, DockPanel.CENTER);

		iOuter.setWidth("100%");

		iOuter.setSpacing(4);
		iOuter.setCellWidth(iCenterPanel, "100%");
		initWidget(iOuter);
	}

}
